<div class='fui-page fui-page-current member-log-page'>
	<div class="fui-header">
        <div class="fui-header-left">
            <a class="back" ng-click='goback()'></a>
        </div>
        <div class="title">配送记录</div>
    </div>
    <div class='fui-content'>
		<div class="fui-tab fui-tab-success">
			<a ng-class="{'active':pagedata.params.status==0}" class="external" href="javascript:;" ng-click="pagedata.params.status=0;tool.get_list('/manage.peiorder/list/',true)">待配送</a>
			<a ng-class="{'active':pagedata.params.status==1}" class="external" href="javascript:;" ng-click="pagedata.params.status=1;tool.get_list('/manage.peiorder/list/',true)">其他记录</a>
		</div>
        <div class='content-empty' ng-show="!pagedata.list || pagedata.list.length<=0">
            <i class='fa fa-comment-o'></i><br/>暂时没有任何配送单!
        </div>
		<div style="padding:0 0.5rem">
        <div ng-repeat="item in pagedata.list" class='fui-cell-group' ng-show="pagedata.list.length>0" >
			<div class="fui-cell">
				<div class="fui-cell-info">
					<div class='title'>
						配送日期 | <span class='bold'>{{item.days}}</span>
						<span>({{item.week}})</span>
					</div>
				</div>
				<div class='fui-cell-remark noremark'>
					<span class='fui-label fui-label-default gray' style="background:#f2f2f2;border-radius:0.2rem;">{{item.statustitle}}</span>
				</div>
			</div>
			<div class="fui-icon-group noborder col-3">
				<div class="fui-icon-col-sm c border" style="margin-top:0">
					<div>应送货</div>
					<div class="subtitle">{{item.allnum || 0}}</div>
				</div>
				<div class="fui-icon-col-sm c border" style="margin-top:0">
					<div>已打印</div>
					<div class="subtitle">{{item.printnum || 0}}</div>
				</div>
				<div class="fui-icon-col-sm c border" style="margin-top:0">
					<div>已交货</div>
					<div class="subtitle">{{item.isnum || 0}}</div>
				</div>
			</div>
			<div class="fui-cell">
				<div class="fui-cell-text">
					<div class="red">{{item.depot.title}}</div>
					<div style="line-height:1.4;color:#999;font-size:0.65rem"><i class="icon icon-wo1"></i> 联系人：<span class="text-danger">{{item.depot.name}}  </span> 联系电话：<a href="tel:{{item.depot.mobile}}" class="text-danger">{{item.depot.mobile}}</a></div>
					<div style="line-height:1.4;color:#999;font-size:0.65rem"><i class="icon icon-ditu"></i> 仓库地址：<span class="text-danger">{{item.depot.pcd.province}} {{item.depot.pcd.city}} {{item.depot.pcd.district}} {{item.depot.pcd.street}} {{item.depot.address}} </span> <a href="javascript:" ng-click="pagedata.openLocation(item.depot);" class="btn btn-sm btn-danger-o" style="font-size:0.65rem;line-height: 1.5;"><i class="icon icon-lvyoutehui"></i>导航</a></div>
				</div>
			</div>
			<div class="fui-cellone" ng-repeat="g in item.goods" ng-if="g.num>0" style="padding:0.3rem 0.5rem">
							<div class="fui-cellone-info">
								{{g.title}}
							</div>
							<div ng-if="g.selespename" class="fui-cellone-info" style="color:red">
								{{g.selespename}}
							</div>
							<div ng-if="g.leititle" class="fui-cellone-info" style="color:red">
								{{g.leititle}}
							</div>
							<div class="fui-cellone-remark noremark">
								{{g.num}}{{g.unit}}
							</div>
			</div>
			<div ng-if="item.status==0" class="right r" style="padding:0.3rem 0.5rem">
				<span>
					<div class="btn btn-sm btn-success-o order-finish" style="font-size:0.7rem" href="javascript:" ng-click="pagedata.show_verify(item.signurl)">配送签到</div>
				</span>
			</div>
			</div>
		</div>
    </div>
</div>
<div ng-if="pagedata.showupsign" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="background:#fc6d60">
			<style>
				input{ caret-color: #fff}
				.fui-cell-group .fui-cell .fui-cell-info  ::-webkit-input-placeholder{
					color: #fff
				}
				.fui-cell-group .fui-cell .fui-cell-info {
					font-size: 0.85rem;
					color: #fff;
				}
			</style>
			<i class="closed icon icon-cuowu" ng-click="pagedata.showupsign=false"></i>
			 <div class='fui-cell-group fui-cell-group-o' style="margin:0.5rem 1rem;padding-top:0.5rem;background:#fc6d60">
				<div class='fui-cell-title c' style="color:#fff">您正在进行“送货签到”操作
				</div>
				<div class='fui-cell' style="padding-bottom:0">
					<div class="fui-cell-text c">
						<div class="img_box" id="show_verify_ewm">
						</div>
					</div>
				</div>
				<div class='fui-cell' style="margin-top:0;padding-top:0">
					<div class="fui-cell-text">
					<div class="error c">
						<p style="padding: 0 1.3rem">温馨提示：提供本二维码给仓库员扫码，完成送货操作！</p>
					</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
scope.pagedata.show_verify=function(signurl){
	scope.pagedata.showupsign=true;
	scope.tool.qr(signurl,'show_verify_ewm',150)
}
</script>
<script>
scope.tool.get_list('/manage.peiorder/list/',true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('/manage.peiorder/list/');
}
scope.pagedata.openLocation=function(item){
	var pcdaddress= item.pcd?item.pcd.province+item.pcd.city+item.pcd.district+item.pcd.street:'';
	var post={
		'address':pcdaddress+item.address,
		'city':item.pcd?item.pcd.city:''
	}
	scope.tool.get_latlng(post,function(res){
		var lat_lng = res.location
		var address_components = res.address_components
		wx.openLocation({
			latitude: lat_lng.lat, // 纬度，浮点数，范围为90 ~ -90
			longitude: lat_lng.lng, // 经度，浮点数，范围为180 ~ -180。
			name: pcdaddress, // 位置名
			address: item.address, // 地址详情说明
			scale: 20, // 地图缩放级别,整形值,范围从1~28。默认为最大
			infoUrl: '', // 在查看位置界面底部显示的超链接,可点击跳转
			success:function(){
				//alert(1111);
			},
			fail:function(res){
				scope.message('导航异常，可能是权限问题：'+res.errMsg);
			}
		});
	});
}
</script>